﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Com.Framework;
using Com.Framework.Data;

namespace Com.Library.DB.Contribute
{
	public class ContributeModel
	{
		public static void Create(string TitleImageURL, string ImageURL, string LinkURL)
		{
			ContributeCreateArguments arg = new ContributeCreateArguments();
			arg.strTitleImageURL = TitleImageURL;
			arg.strImageURL = ImageURL;
			arg.strLinkURL = LinkURL;

			ContributeCreate sp = new ContributeCreate();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
		}

		public static void Modify(int IndexNo, string TitleImageURL, string ImageURL, string LinkURL)
		{
			ContributeModifyArguments arg = new ContributeModifyArguments();
			arg.n4IndexNo = IndexNo;
			arg.strTitleImageURL = TitleImageURL;
			arg.strImageURL = ImageURL;
			arg.strLinkURL = LinkURL;

			ContributeModify sp = new ContributeModify();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
		}

		public static void Remove(int IndexNo)
		{
			ContributeRemoveArguments arg = new ContributeRemoveArguments();
			arg.n4IndexNo = IndexNo;
			ContributeRemove sp = new ContributeRemove();
			sp.SetArguments(arg);
			sp.ExecuteNonQuery();
		}

		public static ListData<ContributeEntity, OutputEntity> GetList(int PageNo, byte PageSize)
		{
			ContributeGetListArguments arg = new ContributeGetListArguments();
			arg.PageNo = PageNo;
			arg.PageSize = PageSize;

			ContributeGetList sp = new ContributeGetList();
			sp.SetArguments(arg);
			List<ContributeEntity> record = sp.Execute();
			OutputEntity output = sp.GetOutput();

			return new ListData<ContributeEntity, OutputEntity>(record, output);
		}

		public static ContributeEntity GetInfo(int IndexNo)
		{
			ContributeGetInfoArguments arg = new ContributeGetInfoArguments();
			arg.n4IndexNo = IndexNo;

			ContributeGetInfo sp = new ContributeGetInfo();
			sp.SetArguments(arg);
			ContributeEntity output = sp.ExecuteNonQuery();

			return output;
		}
	}
}
